<?php
$server = new swoole_server('127.0.0.1',9501);
$server->set(array(
    'reactor_num'   => 3,     // 线程数
    'worker_num'    => 4,     // 进程数
));
$server->on('connect',function($server,$fd){
   echo "Client: Connect.\n";
});

$server->on('receive',function($server,$fd,$reactor_id, $data){
    echo "recive===".$data."\n";
    $server->send($fd,"Client: Receive.\n");
});

$server->on('close',function($server,$fd){
   echo "Client: Close.\n";
});

$server->start();